/*     */ package com.lmpop.trade.ti_custcomment;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.dao.IbatisDbmImpl;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_custcommentInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_custcommentInfo()
/*     */   {
/*  20 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  29 */     RandomID randId = new RandomID();
/*  30 */     String info_id = randId.GenTradeId();
/*     */ 
/*  32 */     Ti_custcomment ti_custcomment = new Ti_custcomment();
/*  33 */     ti_custcomment.setInfo_id(info_id);
/*  34 */     ti_custcomment.setGoods_id(map.getString("goods_id"));
/*  35 */     ti_custcomment.setCom_type(map.getString("com_type"));
/*  36 */     ti_custcomment.setContent(map.getString("content"));
/*  37 */     ti_custcomment.setUser_id(map.getString("session_user_id"));
/*     */ 
/*  39 */     ti_custcomment.setInfo_level(map.getString("info_level"));
/*  40 */     ti_custcomment.setUp_num(Integer.valueOf(map.getString("up_num")).intValue());
/*  41 */     ti_custcomment.setDown_num(Integer.valueOf(map.getString("down_num")).intValue());
/*     */ 
/*  43 */     String userrand = map.getString("userrand");
/*  44 */     String randcode = map.getString("randcode");
/*     */ 
/*  46 */     String result_code = "0";
/*  47 */     String result_info = "";
/*     */     try {
/*  49 */       if (userrand.trim().equals(randcode.trim())) {
/*  50 */         insert(dbmMgr, ti_custcomment);
/*     */       } else {
/*  52 */         result_info = "验证码输入不正确!";
/*  53 */         result_code = "1";
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  57 */       e.printStackTrace();
/*  58 */       result_code = "1";
/*     */     }
/*  60 */     map.setString("result_code", result_code);
/*  61 */     map.setString("result_info", result_info);
/*  62 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_custcomment ti_custcomment)
/*     */     throws ApplicationException
/*     */   {
/*  71 */     dbmMgr.update("insertTi_custcomment", ti_custcomment);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  82 */     String pkid_string = map.getString("pkid");
/*  83 */     String result_code = "0";
/*     */     try {
/*  85 */       if (!pkid_string.equals("")) {
/*  86 */         String[] pkStr = pkid_string.split("\\|");
/*  87 */         for (int i = 0; i < pkStr.length; i++) {
/*  88 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  92 */       e.printStackTrace();
/*  93 */       result_code = "1";
/*     */     }
/*  95 */     map.setString("result_code", result_code);
/*  96 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 105 */     dbmMgr.update("deleteTi_custcomment", pkid);
/*     */   }
/*     */ 
/*     */   public void updateCommentNum(String info_id, int up_num, int down_num)
/*     */   {
/* 116 */     Ti_custcomment ti_custcomment = new Ti_custcomment();
/* 117 */     ti_custcomment.setInfo_id(info_id);
/* 118 */     ti_custcomment.setUp_num(up_num);
/* 119 */     ti_custcomment.setDown_num(down_num);
/* 120 */     DbmInterf dbmMgr = new IbatisDbmImpl();
/* 121 */     dbmMgr.updateSql("updateTi_custcommentCommentNum", ti_custcomment);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 132 */     Ti_custcomment ti_custcomment = new Ti_custcomment();
/* 133 */     ti_custcomment.setInfo_id(map.getString("info_id"));
/*     */ 
/* 142 */     ti_custcomment.setReply_content(map.getString("reply_content"));
/*     */ 
/* 144 */     ti_custcomment.setReply_user_id(map.getString("session_user_id"));
/*     */ 
/* 146 */     String result_code = "0";
/*     */     try {
/* 148 */       update(dbmMgr, ti_custcomment);
/*     */     } catch (ApplicationException e) {
/* 150 */       e.printStackTrace();
/* 151 */       result_code = "1";
/*     */     }
/* 153 */     map.setString("result_code", result_code);
/* 154 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_custcomment ti_custcomment)
/*     */     throws ApplicationException
/*     */   {
/* 163 */     dbmMgr.update("updateTi_custcomment", ti_custcomment);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 173 */     Map ti_custcomment = (Hashtable)obj;
/*     */ 
/* 175 */     if (start == 0)
/* 176 */       start = 0;
/*     */     else {
/* 178 */       start = (start - 1) * limit;
/*     */     }
/*     */ 
/* 181 */     ti_custcomment.put("start", Integer.valueOf(start));
/* 182 */     ti_custcomment.put("limit", Integer.valueOf(limit));
/*     */ 
/* 184 */     String com_type = "";
/* 185 */     if (ti_custcomment.get("com_type") != null) com_type = ti_custcomment.get("com_type").toString();
/*     */ 
/* 188 */     String sqlid = "getListByTi_custcommentPageByCust";
/*     */ 
/* 190 */     if (com_type.equals("2")) {
/* 191 */       sqlid = "getListByTi_custcommentPageByCust";
/*     */     }
/* 193 */     if (com_type.equals("1")) {
/* 194 */       sqlid = "getListByTi_custcommentPageByNews";
/*     */     }
/* 196 */     if (com_type.equals("0")) {
/* 197 */       sqlid = "getListByTi_custcommentPageByGoods";
/*     */     }
/* 199 */     if (com_type.equals("3")) {
/* 200 */       sqlid = "getListByTi_custcommentPageByTeambuy";
/*     */     }
/* 202 */     return this.queryList.getList(sqlid, ti_custcomment);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 213 */     Map ti_custcomment = (Hashtable)obj;
/*     */ 
/* 215 */     String com_type = "";
/* 216 */     if (ti_custcomment.get("com_type") != null) com_type = ti_custcomment.get("com_type").toString();
/*     */ 
/* 219 */     String sqlid = "getCountByObjTi_custcomment";
/* 220 */     if (com_type.equals("1"))
/* 221 */       sqlid = "getCountByObjTi_custcommentByNews";
/* 222 */     else if (com_type.equals("2"))
/* 223 */       sqlid = "getCountByObjTi_custcommentByCust";
/* 224 */     else if (com_type.equals("0")) {
/* 225 */       sqlid = "getCountByTi_custcommentPageByGoods";
/*     */     }
/* 227 */     if (com_type.equals("3")) {
/* 228 */       sqlid = "getCountByTi_custcommentPageByTeambuy";
/*     */     }
/* 230 */     List list = this.queryList.getList(sqlid, ti_custcomment);
/*     */ 
/* 232 */     int count = 0;
/* 233 */     if ((list != null) && (list.size() > 0)) {
/* 234 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 235 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 236 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 239 */     return count;
/*     */   }
/*     */   public List getAvgLevelCountByGoodsID(String pk) {
/* 242 */     return this.queryList.getList("getAvgLevelCountByGoodsID", pk);
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 251 */     return this.queryList.getList("getTi_custcommentByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getCustListByPage(Object obj, int start, int limit)
/*     */   {
/* 262 */     Map params = (Hashtable)obj;
/* 263 */     if (start == 0)
/* 264 */       start = 0;
/*     */     else {
/* 266 */       start = (start - 1) * limit;
/*     */     }
/* 268 */     params.put("start", Integer.valueOf(start));
/* 269 */     params.put("limit", Integer.valueOf(limit));
/* 270 */     return this.queryList.getList("getCsutTi_custcomment", params);
/*     */   }
/*     */ 
/*     */   public int getCustCountByObj(Object obj)
/*     */   {
/* 282 */     Map params = (Hashtable)obj;
/* 283 */     List list = this.queryList.getList("getCsutTi_custcommentCount", params);
/* 284 */     int count = 0;
/* 285 */     if ((list != null) && (list.size() > 0)) {
/* 286 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 287 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 288 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 291 */     return count;
/*     */   }
/*     */ 
/*     */   public List getTeambuyTi_custcomment(Object obj, int start, int limit)
/*     */   {
/* 296 */     Map params = (Hashtable)obj;
/* 297 */     if (start == 0)
/* 298 */       start = 0;
/*     */     else {
/* 300 */       start = (start - 1) * limit;
/*     */     }
/* 302 */     params.put("start", Integer.valueOf(start));
/* 303 */     params.put("limit", Integer.valueOf(limit));
/* 304 */     return this.queryList.getList("getTeambuyTi_custcomment", params);
/*     */   }
/*     */ 
/*     */   public int getTeambuyTi_custcommentCount(Object obj)
/*     */   {
/* 316 */     Map params = (Hashtable)obj;
/* 317 */     List list = this.queryList.getList("getTeambuyTi_custcommentCount", params);
/* 318 */     int count = 0;
/* 319 */     if ((list != null) && (list.size() > 0)) {
/* 320 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 321 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 322 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 325 */     return count;
/*     */   }
/*     */ 
/*     */   public int getCountByUserId(String user_id) {
/* 329 */     List list = this.queryList.getList("getCountByUserId", user_id);
/* 330 */     int count = 0;
/* 331 */     if ((list != null) && (list.size() > 0)) {
/* 332 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 333 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 334 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 337 */     return count;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_custcomment.Ti_custcommentInfo
 * JD-Core Version:    0.6.0
 */